<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui" >

	<h:form id="frm4">
		<p:growl id="msgs1" showDetail="true" />
		<p:panel id="custPanel" header="产品BOM信息维护"
			style="margin-bottom:5px">
			<h:panelGrid columns="8" cellspacing="10">								
				<p:outputLabel value="ID" />
				<p:inputText  value="#{prodBomMB.io.id}" required="true" requiredMessage="编号必须输入"/>
				<p:outputLabel value="产品ID(物料编号)" />
				<p:inputText value="#{prodBomMB.io.pid}" required="true" requiredMessage="产品ID(必须输入"/>
				<p:outputLabel value="物料编号" />
	
				<p:selectOneMenu value="#{prodBomMB.io.mid}"  
					required="true" requiredMessage="物料编号必须输入">
					<f:selectItems value="#{prodBomMB.itemsMid}" />
				</p:selectOneMenu>
				
				<p:outputLabel value="物料数量" />
				<p:inputText value="#{prodBomMB.io.quantity}" />	
				<p:outputLabel value="销售价格" />
				<p:inputText value="#{prodBomMB.io.salePrice}" />	
				<p:outputLabel value="备注" />
				<p:inputText value="#{prodBomMB.io.remarks}" />	
				
					
			</h:panelGrid>
					 
			<h:panelGrid columns="4" cellspacing="10">			
				<p:commandButton value="新增提交"	icon="ui-icon-check" 
					action="#{prodBomMB.addAction}" update=":tabview:frm4">
				</p:commandButton>	
				<p:commandButton value="查询"	icon="ui-icon-search"  immediate="true"
					action="#{prodBomMB.queryAction}" update=":tabview:frm4">
				</p:commandButton>
			</h:panelGrid>
			<p:dataTable id="rdt" value="#{prodBomMB.vo}" var="row" rowIndexVar="rowNum"
				resizableColumns="true" liveResize="true" 
				paginator="true" paginatorPosition="bottom" rows="8"
				editable="true" style="margin-bottom:20px" >
				
				<p:ajax event="rowEdit" listener="#{prodBomMB.onRowEdit}"
					update=":tabview:frm4:msgs1" />
				<p:ajax event="rowEditCancel"	listener="#{prodBomMB.onRowCancel}"
					update=":tabview:frm4:msgs1" />
				<p:column headerText="No." style="width:5%">
					#{rowNum+1}
				</p:column>
				<p:column headerText="ID" sortBy="#{row.id}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.id}" />
						</f:facet>
						<f:facet name="input">
							<h:outputText id="modelInput" value="#{row.id}"
								style="width:100%" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="产品ID">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.pid}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.pid}" style="width:100%"
								label="产品ID" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="物料编号" filterBy="#{row.mid}"	filterMatchMode="contains" >
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.mid}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.mid}" style="width:100%"
								label="物料编号" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="物料数量">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.quantity}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.quantity}" style="width:100%"
								label="物料数量" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="销售价格">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.salePrice}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.salePrice}" style="width:100%"
								label="销售价格" />
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="备注">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{row.remarks}" />
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{row.remarks}" style="width:100%"
								label="备注" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column style="width:32px">
					<p:rowEditor />
				</p:column>
			</p:dataTable>

		</p:panel>
	</h:form>
				
</ui:composition>

